package alkaid.eis.sys.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.beans.BeanUtils;

import alkaid.eis.sys.core.AbstractBaseEntity;
import lombok.Getter;
import lombok.Setter;

/**
 * 字典明细
 * 
 * @author Lucky Yang
 * @since 0.0.1
 */
@Entity
@Getter
@Setter
@Table(name = "eis_sys_dict_detail")
public class DictDetail extends AbstractBaseEntity implements Serializable {
    /** 字典 */
    @ManyToOne
    @JoinColumn(name = "dictId")
    private Dict dict;

    /** 标签 */
    private String label;

    /** 代码 */
    @Column(updatable = false)
    private String code;

    /** 描述 */
    private String description;

    /** 排序 */
    private Integer orderNo;

    /** 启用 */
    private Boolean enabled;

    public DictDetail() {
        
    }

    public DictDetail(String label, String code) {
        this.label = label;
        this.code = code;
    }

    public DictDetail(Dict dict, String label, String code) {
        this.dict = dict;
        this.label = label;
        this.code = code;
    }

    public DictDetail(Dict dict, String label, String code, String description, Integer orderNo, Boolean enabled) {
        this.dict = dict;
        this.label = label;
        this.code = code;
        this.description = description;
        this.orderNo = orderNo;
        this.enabled = enabled;
    }

    public void copy(DictDetail source) {
        BeanUtils.copyProperties(source, this, "id,dict".split(","));
    }
}
